#ifndef _THREADING_STARTER_H
#define _THREADING_STARTER_H

#include "Common.h"

#include <string>

class SERVER_DECL ThreadBase
{
public:
	ThreadBase():m_threadName("NONE") {}
	ThreadBase(const char * threadName):m_threadName(threadName) {}
	ThreadBase(const std::string & threadName):m_threadName(threadName) {}
	virtual ~ThreadBase() {}
	virtual bool run() = 0;
	virtual void OnShutdown() {}
#ifdef WIN32
	HANDLE THREAD_HANDLE;
#else
	pthread_t THREAD_HANDLE;
#endif
	WGSERVER_INLINE const std::string & getThreadName(void) { return m_threadName; }
	WGSERVER_INLINE void setThreadName(const std::string & name) { m_threadName = name; }
	std::string  m_threadName;
};


class SERVER_DECL ThreadRunableBase
{
public:
	ThreadRunableBase() {}
	virtual ~ThreadRunableBase() {}
	virtual bool run( void * p) = 0;
	virtual void OnShutdown() {}
};

#endif

